home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 66
/
Vol 66.iso
/
games
/
bob_espo.swf
/
scripts
/
__Packages
/
MiniGames
/
BTW
/
BTWWallPart.as
< prev
Wrap
Text File
|
2013-04-24
|
2KB
|
75 lines
class MiniGames.BTW.BTWWallPart extends State
{
static var sSTATE_IDLE = "Idle";
static var sSTATE_CRACKED = "Cracked";
static var sSTATE_BROKEN = "Broken";
static var sSTATE_DESTROYED = "Destroyed";
static var nNB_CRACK_SOUNDS = 2;
static var nCRACK_VOLUME = 30;
function BTWWallPart(_mcRef, _oParent)
{
super(_mcRef);
this.setState(MiniGames.BTW.BTWWallPart.sSTATE_IDLE);
this.oParent = _oParent;
this.mcRef.onRelease = Delegate.create(this.oParent,this.oParent.clickOnWall,this);
}
function cleanUp()
{
delete this.mcRef.onRelease;
this.mcRef.onRelease = null;
}
function damage()
{
var _loc2_ = this.sState;
switch(this.sState)
{
case MiniGames.BTW.BTWWallPart.sSTATE_IDLE:
this.setState(MiniGames.BTW.BTWWallPart.sSTATE_CRACKED);
this.playCrackSound();
break;
case MiniGames.BTW.BTWWallPart.sSTATE_CRACKED:
this.setState(MiniGames.BTW.BTWWallPart.sSTATE_BROKEN);
this.playCrackSound();
break;
case MiniGames.BTW.BTWWallPart.sSTATE_BROKEN:
this.setState(MiniGames.BTW.BTWWallPart.sSTATE_DESTROYED);
this.playCrackSound();
break;
case MiniGames.BTW.BTWWallPart.sSTATE_DESTROYED:
}
if(_loc2_ != MiniGames.BTW.BTWWallPart.sSTATE_DESTROYED)
{
this.mcRef.mcRocks.gotoAndPlay(1);
for(var i in this.mcRef.mcRocks)
{
this.mcRef.mcRocks[i].gotoAndPlay(1);
}
}
}
function isDestroyed()
{
var _loc2_ = false;
if(this.sState == MiniGames.BTW.BTWWallPart.sSTATE_DESTROYED)
{
_loc2_ = true;
}
return _loc2_;
}
function playCrackSound()
{
Controller.getRef().getSounds().playRandomSound(MiniGames.BTW.BTWWallPart.nNB_CRACK_SOUNDS,"Wall_Cracked",MiniGames.BTW.BTWWallPart.nCRACK_VOLUME);
}
function Idle()
{
}
function Cracked()
{
}
function Broken()
{
}
function Destroyed()
{
}
}